package com.whmskj.xjlhsc.qianYiData.job;

import com.whmskj.xjlhsc.qianYiData.service.ProcessRunStatsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Slf4j
@Component
public class ProcessRunStatsJob {

    @Resource
    private ProcessRunStatsService service;

    // 每3分钟汇总一次
    @Scheduled(cron = "0 */3 * * * ?")
    public void sync() {
        try {
            int affected = service.sync();
            log.info("ProcessRunStatsJob: affected {} rows", affected);
        } catch (Exception e) {
            log.error("ProcessRunStatsJob: sync failed", e);
        }
    }
}

